home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Tele / C / Comet2.1.3 Folder / Comet / nnr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-03  |  1.8 KB  |  122 lines  |  [TEXT/dumv]

  1. /*
  2.     Copyright Cornell University 1986.  All rights are reserved.
  3.  
  4.     nnr.c contains routines which display a "Network not responding"
  5.     modeless dialog.
  6.     
  7. */
  8.  
  9. #include <em.h>
  10.  
  11. #include <rcodes.h>
  12. #include <resdefs.h>
  13. #include <h19.h>
  14.  
  15. #include <net.h>
  16.  
  17. DialogPtr nnrdptr = NULL;
  18.  
  19.  
  20. #define PGSUCCESS    TRUE
  21.  
  22.  
  23. /* put up a modeless dialog noting that the gateway or host is not
  24.     responding
  25. */
  26.  
  27. setnnr()
  28. {
  29.     int    itemtype;
  30.     Handle    itemh;
  31.     Rect    itembox;
  32.     GrafPtr    oport;
  33.     extern int modaldialog;
  34.     
  35.     if (modaldialog)
  36.         return(0);
  37.  
  38.     CouldDialog(NNRDLOG);
  39.  
  40.     if (IcEchoRequest(rnet->n_defgw, 0) != PGSUCCESS) {
  41.         /* the gateway is presumably down */
  42.         ParamText("\PGateway", "\P", "\P", "\P");
  43.     }
  44.     else {
  45.         HLock(keydp->hhostname);
  46.         ParamText("\Phost", *keydp->hhostname, "\P", "\P");
  47.         HUnlock(keydp->hhostname);
  48.     }
  49.  
  50.     if (!nnrup)
  51.         /* because IcEchoRequest blocks, make sure the connection is still bad! */
  52.         return(0);
  53.  
  54.     if (chkbackground())
  55.         return(0);
  56.         
  57.     emwdeactivate();
  58.     if ((nnrdptr = GetNewDialog(NNRDLOG,NULL,(WindowPtr) (-1))) == NULL)
  59.        return (0);
  60.  
  61.     centerwind(nnrdptr);
  62.  
  63.     GetPort(&oport);
  64.     SetPort(nnrdptr);
  65.  
  66.     SetCursor(&arrow);
  67.     showcursor();
  68.  
  69.     DrawDialog(nnrdptr);
  70.  
  71.     SetPort(oport);
  72.     return(0);
  73. }
  74.  
  75.  
  76. /* dispose of the network not responding alert */
  77.  
  78. clearnnr()
  79. {
  80.     if (nnrdptr == NULL)
  81.        return;
  82.     DisposDialog(nnrdptr);
  83.     FreeDialog(NNRDLOG);
  84.     nnrdptr = NULL;
  85. }
  86.  
  87.  
  88. nnrrefresh(thewind)
  89. WindowPtr thewind;
  90. {
  91. /*
  92.     if (nnrdptr != NULL)
  93.         if (thewind == nnrdptr)
  94.             DrawDialog(nnrdptr);
  95. */
  96. }
  97.  
  98.  
  99. /* display the network not responding alert */
  100.  
  101. shownnr()
  102. {
  103.     if (nnrdptr != NULL) {
  104.         ShowWindow(nnrdptr);
  105.         BringToFront(nnrdptr);
  106.         SetCursor(&arrow);
  107.         showcursor();
  108.     }
  109. }
  110.  
  111.  
  112. /* hide the network not responding alert */
  113.  
  114. hidennr()
  115. {
  116.     if (nnrdptr != NULL) {
  117.         HideWindow(nnrdptr);
  118.         SendBehind(nnrdptr);
  119.     }
  120. }
  121.  
  122.